package com.zhuliwei.exception;

import com.zhuliwei.enums.AppHttpCodeEnum;

/**
 * 自定义异常
 *
 * @author 朱力维
 * @time 2022/10/14 12:23
 **/
public class SystemException extends RuntimeException{

    private int code;

    private String msg;

    public SystemException(String errorMsg) {
        super(errorMsg);
        this.msg = errorMsg;
        this.code = 500;
    }

    public int getCode() {
        return code;
    }

    public String getMsg() {
        return msg;
    }

    public SystemException(AppHttpCodeEnum httpCodeEnum) {
        super(httpCodeEnum.getMsg());
        this.code = httpCodeEnum.getCode();
        this.msg = httpCodeEnum.getMsg();
    }

}
